Project Makefile

A Project Makefile (from now on: Makefile) is a generic Makefile template that SNiFF+ automatically generates and adds to a newly created project. This Makefile is located in the project directory. Makefiles define macros which are used by SNiFF+'s Make Support for building project targets. These macros, in turn, are expanded to the values of other macros defined in Make Support Files. There are macro definitions, e.g., for:

- the targets built in the project
- the components needed to build the targets
- dependency information
- include path information

Macro definitions are automatically maintained by SNiFF+. The values of the macros used in the Makefile are taken from the Build Options view of the Project Attributes dialog.
For details about the macros defined in a Makefile, please refer directly to a project's Makefile. Make Support Files are discussed on page 102.
Configuring the Project Makefile (excluding Java)
For configuring Make Support for Java, please refer to the Technical Reference in the Java tutorial. In general, it is unnecessary for you to modify a project's Makefile. By modifying the Project Makefile, you can extend or override all settings that you make in the SNiFF+ Project Attributes. However, you should try to avoid such modifications wherever possible because they are usually hard to migrate to new versions of SNiFF+.
All macros defined in a Platform Makefile can be overridden in the Project Makefile, but note that this makes the current project platform dependent. Therefore, we discourage changing any settings in the Project Makefile apart from the examples shown below.
In a project's Makefile, you can also redefine the platform-independent flags and macros that are set in the General Makefile. If you want to incorporate additional Make rules in a project's Makefile, you must do so after the code line that includes the General Makefile:
include $(SNIFF_DIR)/make_support/general.mk
Additional flags can be defined using macros containing the prefix OTHER_ . Multiple additional flags are separated from each other by spaces.

Example | Description
Include .sniffmake/macros.incl | If you modified the Directory for Make Support Files in your Project Attributes, then you need to modify the line which includes macros.incl , all future lines will be set correctly through the $(SNIFF_MAKEDIR) macro. Note that if you generally want to use a different directory for your SNiFF generated Make Support files, you should change the Makefile Template in $SNIFF_DIR/config/template.Makefile .
SUB_LIBS = lib1 lib2 $(SNIFF_SUB_LIBS) | If your executable depends on linking sub libraries in a particular order, you may add the libraries which should be linked first to the SUB_LIBS macro. This can also be used to force linking to shared libraries which are produced by subprojects. By default, SNiFF+'s Make Support doesn't pass shared libraries to superprojects.
SUBDIRS = my_subdir $(SNIFF_SUBDIRS) | Additional Recursive Make Subdirectories generated in the SNiFF Project Attributes will be overwritten when you press the Generate button there. To make sure that such subdirectories are persistent, you may add them in your project Makefile.
OTHER_CLEANUP = "*.bak" "*~" | Additional patterns that you would like to remove if a make clean is issued
PURIFY_TARGET = \$(LINK_TARGET).purify | By defining this macro, you activate the purify rule of the global Make Support for the current project.
OTHER_CXXFLAGS = $(CXX_DEBUGFLAG) | Produce debugging information in this project, even if the global options turn it off. Using CXXFLAGS in the project Makefile would overwrite the global settings from the Platform Makefile.
OTHER_IDLFLAGS = -DmyLocalDef | Use a specific Preprocessor definition also for IDL. In general, all OTHER_XXX macros are meant to hold such additional switches which should be valid only in the local project.
IDL_CFILE_TYPE_SPEC = C | Build an IDL Client here. For details, see IDL Setup in the User's Guide.
PRE_TARGETS = my_pretarget \$(SNIFF_PRETARGETS) | If one target needs to be compiled before all other files in this project, add it to the PRE_TARGETS macro.
MAKEFILE = Makefile.server | If your local Makefile has a different name, you must set this macro in order for make running in a sub-process to work correctly. Note, that in order for Recursive Make to work correctly, you also need a file named Makefile in addition to your renamed one (for details, see IDL Setup in the User's Guide).
all :: additional_stuff additional_stuff : x1.gen x2.gen $(GENERATOR) $* | You can add local rules for additional stuff to the all target if you use the double colon. Your additional_stuff should be defined as other target in the SNiFF Project Attributes. Note: if you define this rule before including general.mk , it will be executed before your SNiFF+ main target, if you add the all rule after including general.mk , it will be executed after the main target and the subdirectories have been built.

.